import { Navigate } from "react-router-dom";
import { RouteType } from "@/types/route";
// 导入所需组件，首页  关于
import HomeView from "@/views/home/index";
import MusicView from "@/views/music/index";
import VideoView from "@/views/video/index";
import MyView from "@/views/my/index";
import AboutView from "@/views/about/index";
import ProductView from "@/views/product/index";
import ProductDetail from "@/views/product/detail";
// 导入管理员页面
import AdminView from "@/views/admin/index";
import DashView from "@/views/admin/children/dash";
import OrdersView from "@/views/admin/children/orders";
import {
	AppstoreOutlined,
	MailOutlined,
	SettingOutlined
} from "@ant-design/icons";
const routes: RouteType[] = [
	{
		path: "",
		element: <Navigate to="/home" />
	},
	{
		path: "home",
		label: "首页",
		// 是否是菜单
		isMenu: true,
		// 配置路由元信息
		meta: {
			title: "首页"
		},
		element: <HomeView />,
		icon: <MailOutlined />
	},
	{
		path: "music",
		label: "音乐",
		isMenu: true,
		meta: {
			title: "音乐"
		},
		element: <MusicView />,
		icon: <AppstoreOutlined />
	},
	{
		path: "video",
		label: "视频",
		isMenu: true,
		meta: {
			title: "视频"
		},
		element: <VideoView />,
		icon: <SettingOutlined />
	},
	{
		path: "my",
		label: "主页",
		isMenu: true,
		meta: {
			title: "主页"
		},
		element: <MyView />,
		icon: <SettingOutlined />
	},
	{
		path: "about",
		label: "关于",
		isMenu: true,
		meta: {
			title: "关于"
		},
		element: <AboutView />
	},
	{
		path: "product",
		label: "商品",
		isMenu: true,
		meta: {
			title: "商品"
		},
		element: <ProductView />,
		children: []
	},
	{
		path: "product/:id",
		label: "商品详情",
		meta: {
			title: "商品详情"
		},
		element: <ProductDetail />
	},
	{
		path: "admin",
		label: "管理员",
		isMenu: true,
		meta: {
			title: "管理员"
		},
		element: <AdminView />,
		// 配置子路由
		children: [
			{
				path: "dash",
				label: "管理首页",
				isMenu: true,
				meta: {
					title: "管理首页"
				},
				element: <DashView />
			},
			{
				path: "orders",
				label: "订单",
				isMenu: true,
				meta: {
					title: "订单"
				},
				element: <OrdersView />
			}
		]
	}
];
export default routes;
